<!DOCTYPE html>
<!-- saved from url=(0028)http://easyds.cn/m/agreement -->
<html lang="zh-CN">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>用户反馈</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta content="telephone=no" name="format-detection">
    <script src="__PUBLIC__/js/hm.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/jquery.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/css/bootstrap.min.css">
    <script type="text/javascript" src="__PUBLIC__/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/css/share.css">
    <script type="text/javascript" src="__PUBLIC__/js/share.js"></script>
    <script type="text/javascript" src="__PUBLIC__/js/downpdf.js"></script>
    <script>
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "//hm.baidu.com/hm.js?af934acc7ae6dafe48cf666217f5c049";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>
    <script>
        $.setCookie("randomCode","asdfjkl;",1);
            $.setCookie("myuid","f3da5956-8e2c-4948-982f-92af2a019cdc",356);
            //alert("f3da5956-8e2c-4948-982f-92af2a019cdc");
    </script>
    <link rel="stylesheet" href="__PUBLIC__/css/user.css">
    <script type="text/javascript" src="__PUBLIC__/js/ajaxfileupload.js"></script>
    <style type="text/css">
        #uploadForm{
        }
        .addImg{
            background-image:url("/img_mo/user/add_img.png?v=2016120701232");
            background-repeat: no-repeat;
            width: 78px;
            height: 78px;
            margin-left: 20px;
            float: left;
        }
        .addImg input{
            opacity: 0;
            width: 78px;
            height: 78px;
        }
        #preview{
            width: 78px;
            height: 78px;
            margin-left: 20px;
            float: left;
        }
        #imghead {
            width: 78px;
            height: 78px;
            margin-top: 0px!important;
            filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=image);
        }
    </style>
    <script type="text/javascript">
        //图片上传预览    IE是用了滤镜。
        function previewImage(file) {
            var MAXWIDTH  = 260;
            var MAXHEIGHT = 180;
            var div = document.getElementById('preview');
            if (file.files && file.files[0]) {
                div.innerHTML ='<img id=imghead>';
                var img = document.getElementById('imghead');
                img.onload = function(){
                    var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
                    img.width  =  rect.width;
                    img.height =  rect.height;
//                 img.style.marginLeft = rect.left+'px';
                    img.style.marginTop = rect.top+'px';
                }
                var reader = new FileReader();
                reader.onload = function(evt){img.src = evt.target.result;}
                reader.readAsDataURL(file.files[0]);
            }
            else {//兼容IE
                var sFilter='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="';
                file.select();
                var src = document.selection.createRange().text;
                div.innerHTML = '<img id=imghead>';
                var img = document.getElementById('imghead');
                img.filters.item('DXImageTransform.Microsoft.AlphaImageLoader').src = src;
                var rect = clacImgZoomParam(MAXWIDTH, MAXHEIGHT, img.offsetWidth, img.offsetHeight);
                status =('rect:'+rect.top+','+rect.left+','+rect.width+','+rect.height);
                div.innerHTML = "<div id=divhead style='width:"+rect.width+"px;height:"+rect.height+"px;margin-top:"+rect.top+"px;"+sFilter+src+"\"'></div>";
            }
        }
        function clacImgZoomParam( maxWidth, maxHeight, width, height ){
            var param = {top:0, left:0, width:width, height:height};
            if( width>maxWidth || height>maxHeight ) {
                rateWidth = width / maxWidth;
                rateHeight = height / maxHeight;
                if( rateWidth > rateHeight ) {
                    param.width =  maxWidth;
                    param.height = Math.round(height / rateWidth);
                }else {
                    param.width = Math.round(width / rateHeight);
                    param.height = maxHeight;
                }
            }
            param.left = Math.round((maxWidth - param.width) / 2);
            param.top = Math.round((maxHeight - param.height) / 2);
            return param;
        }
    </script>
</head>
<body style="background-color:#e3e3e3;">
<div class="navbar">
    <div class="navbar-top3">
        <a class="navbar-left2" href="javascript:void(0)" onclick="backbtn()"><img src="__PUBLIC__/images/back-icon.png"></a>
        <span class="navbar-center">用户反馈</span>
        <div class="navsearchright">
        </div>
    </div>
</div>
<div class="topBanner">
    <img class="" src="__PUBLIC__/images/fankui.png">
    <form id="uploadForm" action="http://easyds.cn/m/agreementsubmit.do" method="post" enctype="multipart/form-data">
        <div class="shangchuan">
        <textarea name="agreementinfo" type="text" class="" id="agreementname" placeholder="请详细描述你的问题或建议，我们会及时跟进解决，有问必答，当天回复。（最好能附上相关问题截图）"></textarea>
            <div class="addImg">
                <input type="file" id="files" name="files" onchange="previewImage(this)">
            </div>
            <div id="preview">
                <img id="imghead" border="0"  width="180" height="180">
            </div>
        </div>
        <div class="emailInput">
            <input name="agreementemail" type="email" class="" id="agreementemail" placeholder="请输入邮箱以便联系（必填）" value="13702387651@163.com">
        </div>
        <div class="falsetxt">请填写建议和邮箱</div>
        <input type="button" class="" readonly="readonly" id="tijiao" value="提交" onclick="ajaxFileUpload();">
    </form>
</div>








<script type="text/javascript">
    $(document).ready(function() {
        $(".checkBox label").click(function(){
            $(".checkBox label").toggleClass("comeOn")
        })
        $(".secret span").click(function(){
            $(".secret span").toggleClass("comeOn")
        })
    })


    //上传文件
    function ajaxFileUpload(){
        $(".falsetxt").css("display","none").text("请填写建议和邮箱");
        if($.trim($("#agreementname").val()).length==0 || $.trim($("#agreementemail").val()).length==0){
            $(".falsetxt").css("display","block");
            return false;
        }
        if(!valid_email($("#agreementemail").val())){
            $(".falsetxt").text("邮箱格式不正确").css("display","block");
            return false;
        }

        $("#tijiao").attr("disabled","disabled").css("background-color","#e0e0e0").css("color","#9d9d9d").val("正在提交");


        $.ajaxFileUpload(
            {
                url:'/m/agreementsubmit.do?agreementinfo='+$("#agreementname").val()+'&agreementemail='+$("#agreementemail").val(),            //需要链接到服务器地址
                secureuri:false,
                fileElementId:'files',                        //文件选择框
                // 的id属性
                dataType: 'json',                                     //服务器返回的格式，可以是json
                success: function (data, status)            //相当于java中try语句块的用法
                {
                    if(data=="success"){
                        //成功
                        alert("提交成功");
                        window.location.href="/m";
                    }
                },
                error: function (data, status, e)            //相当于java中catch语句块的用法
                {
                    alert("发生错误，请稍候再试");
                    $("#tijiao").attr("disabled","").css("background-color","").css("color","").val("提交");
                }
            }
        );
    }
</script></body></html>